package test3;

public class GirlFriendTest {
    public static void main(String[] args) {
        GirlFriend[] arr =new GirlFriend[10];

        GirlFriend gf1 = new GirlFriend(20,"小诗诗","女","弹琴");
        GirlFriend gf2 = new GirlFriend(18,"小默默","女","电视");
        GirlFriend gf3 = new GirlFriend(19,"小嘟嘟","女","唱歌");
        GirlFriend gf4 = new GirlFriend(21,"小娜娜","女","画画");

        arr[0] = gf1;
        arr[1] = gf2;
        arr[2] = gf3;
        arr[3] = gf4;

        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            /*GirlFriend gf = arr[i];*/
            sum = sum + arr[i].getAge();
        }

        int avg = sum / arr.length;

        int count = 0;
        for (int i = 0; i < arr.length; i++) {
            /*GirlFriend gf = arr[i];*/
            if(arr[i].getAge() < avg){
                count++;
                System.out.println(arr[i].getName() + "," + arr[i].getAge() + "," + arr[i].getGender() + "," + arr[i].getHobbies());
            }
        }
        System.out.println(count + "个");

    }
}
